<!DOCTYPE html>
<html>
    <head>
        <title>Itowns - Using an external scene</title>

        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="css/example.css">
        <link rel="stylesheet" type="text/css" href="css/loading_screen.css">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div id="viewerDiv">
        </div>
        <script src="../dist/itowns.js"></script>
        <script src="js/loading_screen.js"></script>
        <script type="text/javascript">
            var positionOnGlobe = { longitude: 2.351323, latitude: 48.856712, altitude: 25000000 };

            var scene = new itowns.THREE.Scene();

            // iTowns namespace defined here
            var viewerDiv = document.getElementById('viewerDiv');
            var view = new itowns.GlobeView(
                    viewerDiv, positionOnGlobe, { scene3D: scene });
            setupLoadingScreen(viewerDiv, view);

            view.mainLoop.name = 'external-ML';

            itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
                config.source = new itowns.WMTSSource(config.source);
                var layer = new itowns.ColorLayer(config.id, config);
                view.addLayer(layer);
            });
            itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT.json').then(function _(config) {
                config.source = new itowns.WMTSSource(config.source);
                var layer = new itowns.ElevationLayer(config.id, config);
                view.addLayer(layer);
            });
        </script>
    </body>
</html>
